/* Note: 	position_data_final.do  
*  Input: 	reg_full_final.dta				// Only the data without copyright are shared. 
*  Plots: 	hetero_dptc_before.pdf 			// Figure 5a
			hetero_dptc_after.pdf			// Figure 5b
			hetero_dptc_before_db.pdf		// Figure 6a 
			hetero_dptc_after_db.pdf		// Figure 6b
*/

grstyle init
clear all

cd "$FOLDER"

**Plots: Before vs. After DPTC Ratios

********************************************************************************
*	Foreign Banks
********************************************************************************
use "./Data/reg_full_final", clear

keep if FB==1

grstyle set plain, horizontal
*color("55 126 184 %50")
twoway(hist DPTCRatio if mdate==tm(2009m12), w(0.5) freq color(gray%50) xline(2.5, lwidth(thick)) xlabel(2.5 "2.5", add labsize (*.75)) ), ///
xtitle(FXD/Capital, size(medlarge)) ytitle(Number of Banks, size(medlarge)) legend(label(1 "Before (2009 Dec)")) 
graph export "./Output/Figure_5a_hetero_dptc_before.pdf", as(pdf) replace

summarize DPTCRatio if mdate==tm(2009m12)
twoway(hist DPTCRatio if mdate==tm(2010m12),  xscale(range(`r(min)' `r(max)')) w(0.5) freq color(gray%50) xline(2.5, lwidth(thick)) xlabel(2.5 "2.5", add labsize (*.75)) ), ///
xtitle(FXD/Capital, size(medlarge)) ytitle(Number of Banks, size(medlarge)) legend(label(1 "After (2010 Dec)"))  
graph export "./Output/Figure_5b_hetero_dptc_after.pdf", as(pdf) replace


********************************************************************************
*	Domestic Banks
********************************************************************************

use "./Data/reg_full_final", clear
keep if FB==0
grstyle set plain, horizontal
*color("55 126 184 %50")
twoway(hist DPTCRatio if mdate==tm(2009m12), w(0.1) freq color(gray%50) xline(0.5, lwidth(thick)) xlabel(0.5 "0.5", add labsize (*.75)) ), ///
xtitle(FXD/Capital, size(medlarge)) ytitle(Number of Banks, size(medlarge)) legend(label(1 "Before (2009 Dec)")) 
graph export "./Output/Figure_6a_hetero_dptc_before_db.pdf", as(pdf) replace

summarize DPTCRatio if mdate==tm(2009m12)
twoway(hist DPTCRatio if mdate==tm(2010m12),  xscale(range(`r(min)' `r(max)')) w(0.1) freq color(gray%50) xline(0.5, lwidth(thick)) xlabel(0.5 "0.5", add labsize (*.75)) ), ///
xtitle(FXD/Capital, size(medlarge)) ytitle(Number of Banks, size(medlarge)) legend(label(1 "After (2010 Dec)"))  
graph export "./Output/Figure_6b_hetero_dptc_after_db.pdf", as(pdf) replace
